@keyframes pwa-opened {
  from {
    opacity: 0.4;
    transform: scale(0.8, 0.8);
  }

  to {
    opacity: 1;
    transform: scale(1, 1);
  }
}

@keyframes pwa-mobile {
  from {
    opacity: 0.6;
  }

  to {
    opacity: 1;
  }
}

@keyframes pwa-fade-in {
  from {
    opacity: 0.2;
  }

  to {
    opacity: 1;
  }
}

.modal-button {
  position: fixed;

  right: 1rem;
  bottom: 1rem;
  z-index: 50;

  padding: 0 16px;
  border-width: 0;
  border-radius: 1.2rem;

  background: var(--pwa-btn-bg-color);
  color: var(--pwa-btn-text-color);
  outline: none;

  font-weight: 600;
  line-height: 2.2rem;

  cursor: pointer;

  transition:
    background 0.3s,
    color 0.3s;

  @media (display-mode: standalone) {
    display: none;
  }

  @media print {
    display: none;
  }

  &:hover,
  &:active {
    background: var(--pwa-btn-hover-bg-color);
  }
}

#install-modal-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 997;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: auto;

  width: 100vw;
  height: 100vh;

  @media print {
    display: none;
  }

  button {
    border-width: 0;
    background: transparent;
    cursor: pointer;
  }

  .background {
    position: fixed;
    inset: 0;
    z-index: 998;

    animation: 0.25s pwa-fade-in;

    backdrop-filter: blur(10px);
  }

  .install-modal {
    position: absolute;
    z-index: 999;

    display: flex;
    flex-direction: column;

    max-width: 56em;
    border-radius: 10px;

    background: var(--pwa-bg-color);

    transition: background 0.3s;
    animation: 0.15s pwa-opened;

    @media (max-width: 1280px) {
      width: 92%;
      animation: 0.25s pwa-mobile;
    }

    @media (max-width: 419px) {
      overflow-y: auto;
      max-height: 80%;

      &::-webkit-scrollbar {
        display: none;
      }
    }
  }

  .header {
    margin: 40px 40px 32px;

    @media (max-width: 959px) {
      margin-bottom: 24px;
    }

    @media (max-width: 719px) {
      margin: 20px;
    }

    .close-button {
      border-width: 0;
      float: right;
      background: transparent;
      color: var(--pwa-content-color);
      transition: color 0.3s ease;
      cursor: pointer;

      &:hover,
      &:focus {
        color: var(--pwa-content-light-color);
      }
    }

    .logo {
      display: flex;
    }

    h1 {
      margin-top: 0;
      margin-bottom: 7px;
      color: var(--pwa-content-light-color);
      font-size: 34px;

      @media (max-width: 959px) {
        margin-bottom: 0;
      }

      @media (max-width: 419px) {
        font-size: 26px;
      }
    }

    img {
      width: 122px;
      height: 122px;
      margin-inline-end: 24px;
      padding: 12px;
      border-radius: 24px;

      @media (max-width: 959px) {
        width: 60px;
        height: 60px;
      }

      @media (max-width: 719px) {
        margin-inline-end: 12px;
        padding: 8px;
      }

      @media (max-width: 419px) {
        width: 40px;
        height: 40px;
        padding: 6px;
      }
    }

    .desc {
      overflow: hidden;

      max-width: 40em;

      color: #888;

      font-size: 14px;
      text-overflow: ellipsis;
      white-space: pre-wrap;

      @media (max-width: 959px) {
        display: none;
      }
    }
  }

  .content {
    flex: 1;
    margin: 0 40px;
    color: var(--pwa-content-color);

    @media (max-width: 719px) {
      margin: 0 20px;
    }

    h3 {
      margin-bottom: 12px;
      font-size: 22px;
    }

    p {
      font-size: 14px;
    }
  }

  .highlight {
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin-inline-end: 20px;

    @media (max-width: 719px) {
      flex-direction: column;
      align-items: flex-start;
      margin-inline-end: 0;
    }

    h3 {
      margin-top: 0;
      font-weight: 600;
      font-size: 22px;
      line-height: 225%;

      @media (max-width: 419px) {
        margin-bottom: 0;
        font-size: 18px;
      }
    }
  }

  .feature-wrapper {
    overflow: hidden;
    padding-inline-end: 2em;

    ul {
      margin-block-start: 12px;
      padding-inline-start: 22px;

      @media (max-width: 419px) {
        margin-top: 0;
      }
    }

    li {
      color: var(--pwa-content-light-color);

      font-weight: 600;
      font-size: 16px;
      line-height: 29px;

      transition: color 0.3s;
    }
  }

  .screenshot-wrapper {
    display: flex;
    max-width: 30em;
    max-height: 220px;

    @media (max-width: 719px) {
      width: 100%;
    }

    button {
      width: 4em;
      border-width: 0;
      background: transparent;
      cursor: pointer;
      transition: background 0.3s;

      &:hover,
      &:focus {
        background: #bbb;
      }

      svg {
        width: 28px;
        fill: #6b6969;
      }
    }
  }

  .screenshot {
    display: flex;
    flex-flow: column wrap;

    overflow-x: auto;
    -webkit-overflow-scrolling: touch;

    width: 22em;
    max-height: 220px;

    scroll-snap-type: x mandatory;

    @media (max-width: 1280px) {
      justify-content: center;
    }

    &::-webkit-scrollbar {
      display: none;
    }

    div {
      display: flex;
      align-items: center;
      justify-content: center;

      width: 100%;
      height: 14em;

      background: #efefef;

      scroll-snap-align: start;
    }

    img {
      object-fit: contain;
      height: 100%;

      @media (max-width: 719px) {
        height: 180px;
      }
    }
  }

  .description {
    margin-bottom: 3em;
  }

  .button-wrapper {
    width: 100%;
    padding: 1rem 0;
    text-align: end;

    @media (max-width: 719px) {
      text-align: center;
    }
  }

  .install-button,
  .cancel-button {
    display: inline-block;
    flex: 0 0 auto;

    min-width: 80px;
    margin: 0.5rem 1rem;
    padding: 0.5rem 1rem;
    border: 2px solid var(--pwa-btn-bg-color);
    border-radius: 20px;
    background: transparent;

    font-weight: 600;
    font-size: 14px;

    cursor: pointer;
  }

  .install-button {
    background: var(--pwa-btn-bg-color);
    color: var(--pwa-bg-color);
    transition: color 0.3s;

    @media (max-width: 419px) {
      span {
        display: none;
      }
    }

    &:hover,
    &:focus {
      background: var(--pwa-btn-hover-bg-color);
    }
  }

  .cancel-button {
    background: transparent;
    color: var(--pwa-btn-bg-color);

    &:hover,
    &:focus {
      background: var(--pwa-btn-hover-bg-color);
      color: var(--pwa-bg-color);
    }
  }

  .ios-text {
    position: fixed;
    bottom: 0;

    box-sizing: border-box;

    width: 92%;
    margin: 2em auto;
    padding: 0.5em 2em;
    border-radius: 8px;

    background: var(--pwa-bg-color);
    box-shadow: 0 2px 12px 0 var(--pwa-shadow-color);

    font-weight: bold;
    font-size: 14px;
    text-align: center;

    transition:
      background 0.3s,
      box-shadow 0.3s;

    &::after {
      content: ' ';

      position: absolute;
      bottom: -1em;
      left: calc(50% - 0.8em);

      width: 0;
      height: 0;
      border-top: 1em solid var(--pwa-bg-color);
      border-right: 0.8em solid transparent;
      border-left: 0.8em solid transparent;

      transition: border-color 0.3s;
    }

    p {
      margin: 0 0 0.5em;
    }

    .success {
      margin-bottom: 0.5em;
      padding: 0.5em 1em;
      border: none;
      border-radius: 1em;

      background: #07c160;
      color: var(--pwa-bg-color);

      cursor: pointer;

      transition: color 0.3s;
    }
  }
}
